package com.izhaowo.recommend.contrl;

import com.google.gson.Gson;
import com.izhaowo.recommend.util.HBaseUtil;
import com.izhaowo.recommend.vo.*;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.text.SimpleDateFormat;
import java.util.*;

/**
 * Created by HASEE on 2019/7/23.
 */

@Controller
public class QueryRecomPlanner {
    final static Gson gson = new Gson();
    private static final Logger logger = LoggerFactory.getLogger(QueryRecomPlanner.class);

    @ResponseBody
    @RequestMapping("/hello")
    public String hello() {
        return "Hello World";
    }

    @ResponseBody
    @RequestMapping(value = "/queryWeddingRecomPlanner")
    public String queryWeddingRecomPlanner(
            @RequestParam(value = "weddingId") String weddingId,
            @RequestParam(value = "province") String province,
            @RequestParam(value = "inArea") Integer inArea,
            @RequestParam(value = "plannerTag", required = false, defaultValue = "") String plannerTag,
            @RequestParam(value = "test", required = false, defaultValue = "no") String test) throws Exception {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String startTime = sdf.format(new Date());
        List<PlannerQueryInfoVO> r = WeddingRecomPlanner.queryWeddingRecomPlannerNew(weddingId, province, inArea, plannerTag);

        // todo 增加推荐结果数据存储。年月日=weddingID=len数字,可预订策划师数据表。 by hiwes
        for (PlannerQueryInfoVO p : r) {
            Result2Vo.saveRecomResult2HBase(weddingId, p.getWorkerId(), String.valueOf(inArea));
        }
        logger.info("___   wedding_id result  is  " + weddingId + " , inArea is  " + inArea +
                " , province  is  " + province + " , result is  " +
                (r.isEmpty() ? " []" : r.size()));
        if ("no".equals(test))
            WeddingRecomPlanner.saveRecomResult_v3(weddingId, province, inArea, startTime, r, plannerTag);
        return null == r ? "返回结果为空" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/yingjingPlanner")
    public String queryyingjingPlanner(
            @RequestParam(value = "budget", required = false, defaultValue = "") Integer budget,
            @RequestParam(value = "hotelId", required = false, defaultValue = "") String hotelId,
            @RequestParam(value = "scheduleDay", required = false, defaultValue = "") String scheduleDay,
            @RequestParam(value = "plannerTag", required = false, defaultValue = "") String plannerTag,
            @RequestParam(value = "nature", required = false, defaultValue = "") String nature,
            @RequestParam(value = "test", required = false, defaultValue = "no") String test
    ) throws Exception {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String startTime = sdf.format(new Date());

        List<PlannerQueryInfoVO> r = WeddingRecomPlanner.queryWeddingRecomPlannerYingJing(budget, hotelId, scheduleDay, plannerTag, nature);

//        if ("no".equals(test))
//            WeddingRecomPlanner.saveRecomResult_v3(weddingId, "四川", 15, startTime, r, plannerTag);

        return null == r ? "婚礼信息不存" : gson.toJson(r);
    }


    @ResponseBody
    @RequestMapping("/getRecommendResultMsg")
    public String getRecommendResultMsg(@RequestParam(value = "msgType", required = false, defaultValue = "count") String msgType,
                                        @RequestParam(value = "dayStr", required = false, defaultValue = "") String dayStr,
                                        @RequestParam(value = "weddingId", required = false, defaultValue = "") String weddingId,
                                        @RequestParam(value = "inArea", required = false, defaultValue = "") String inArea,
                                        @RequestParam(value = "filter", required = false, defaultValue = "yes") String filter) {
        StringBuffer sb = new StringBuffer();
        StringBuffer rowKey = new StringBuffer();
        if (StringUtils.isNotBlank(dayStr)) {
            sb.append(dayStr);
            rowKey.append(sb.reverse());
        }
        if (StringUtils.isNotBlank(weddingId)) {
            rowKey.append("=").append(weddingId);
        }
        if (StringUtils.isNotBlank(inArea)) {
            rowKey.append("=").append(inArea);
        }
        Object r = null;
        String start = StringUtils.isNotBlank(rowKey.toString()) ? rowKey.toString() : null;
        String end = StringUtils.isNotBlank(rowKey.toString()) ? rowKey.toString() + ">" : null;
        if ("count".equals(msgType))
            r = RecommendWeddingPlanner.queryRecomendResultMsgCount(start, end, filter);
        else
            r = RecommendWeddingPlanner.queryRecomendResultMsg(start, end);
        return null == r ? "婚礼信息不存" : gson.toJson(r);

    }


    @ResponseBody
    @RequestMapping("/getHotelInAreaMsg")
    public String getHotelInAreaMsg(@RequestParam(value = "hotelId", required = false, defaultValue = "") String hotelId,
                                    @RequestParam(value = "dayStr", required = false, defaultValue = "") String dayStr) {
        StringBuffer rowKey = new StringBuffer();
        if (StringUtils.isNotBlank(hotelId)) {
            rowKey.append(hotelId);
        }
        if (StringUtils.isNotBlank(dayStr)) {
            rowKey.append("=").append(dayStr);
        }

        String start = StringUtils.isNotBlank(rowKey.toString()) ? rowKey.toString() : null;
        String end = StringUtils.isNotBlank(rowKey.toString()) ? rowKey.toString() + ">" : null;
        Object r = RecommendWeddingPlanner.queryHotelInAreaMsg(start, end);

        return null == r ? "婚礼信息不存" : gson.toJson(r);

    }

    @ResponseBody
    @RequestMapping("/userWedding")
    public String testUserWedding(@RequestParam(value = "weddingId") String weddingId) {
        UserWeddingVO r = RecommendWeddingPlanner.getUserWeddingById(weddingId);
        return null == r ? "婚礼信息不存" : gson.toJson(r);
    }


    @ResponseBody
    @RequestMapping("/getYingJingPlannerSection")
    public String YingJingPlannerSection() {
        List<YingjingPlannerSectionVO> r = RecommendWeddingPlanner.getYingJingPlannerSection(null);
        return null == r ? "婚礼信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/getYingJingPlannerPersonality")
    public String getYingJingPlannerPersonality() {
        List<YingjingPlannerPersonalityVO> r = RecommendWeddingPlanner.getYingJingPlannerPersonality(null);
        return null == r ? "婚礼信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/queryOrderReturnPlanner")
    public String queryOrderIsReturn(@RequestParam(value = "weddingId") String weddingId) {
        List<PlannerQueryInfoVO> r = WeddingRecomPlanner.getOrderReturnPlanner(weddingId, "noMonth");
        return null == r ? "婚礼信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/talkOrderPlanner")
    public String queryTalkOrderPlanner(@RequestParam(value = "budget") Integer budget,
                                        @RequestParam(value = "tags") String tags,
                                        @RequestParam(value = "provinceId") String province,
                                        @RequestParam(value = "scheduleDay") String scheduleDay,
                                        @RequestParam(value = "weddingDate") String weddingDate
    ) {
        List<TalkOrderPlannerVO> r = WeddingRecomPlanner.getTalkOrderPlanner(budget, tags, province, scheduleDay, weddingDate);
        return null == r ? "婚礼信息不存" : gson.toJson(r);
    }


    @ResponseBody
    @RequestMapping("/calPhotoScore")
    public String calPhotoScore(@RequestParam(value = "interval") Integer interval) {
        Object r = CalPlannerIndex.calPhotoScore(interval);
        return null == r ? "婚礼信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/getPhotoScore")
    public String getPhotoScore(@RequestParam(value = "day") String day) {
        Object r = CalPlannerIndex.getPhotoScore(day);
        return null == r ? "婚礼信息不存" : gson.toJson(r);
    }


    @ResponseBody
    @RequestMapping("/getLowBudgetPlanner")
    public String getLowBudgetPlanner() {
        List<PlannerRecomRankVO> r = RecommendWeddingPlanner.queryPlannerRecomRankVersion2();
        return null == r ? "婚礼信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/getPlannerTags")
    public String getPlannerTags() {
        Object r = RecommendWeddingPlanner.queryPlannerWeddingTag();
        return null == r ? "婚礼信息不存" : gson.toJson(r);
    }


    @ResponseBody
    @RequestMapping("/getSmallMaket")
    public String getSmallMaket(@RequestParam(value = "hotel_id") String hotel_id,
                                @RequestParam(value = "section") Integer section,
                                @RequestParam(value = "weddate") String weddate) {
        List<HotelPlannerRecomRankVO> r = WeddingRecomPlanner.getSmallMaketV2(hotel_id, section, weddate);
        return null == r ? "婚礼信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/getSmallMaketWorker")
    public String getSmallMaketWorker(@RequestParam(value = "hotel_id") String hotel_id,
                                      @RequestParam(value = "section") Integer section,
                                      @RequestParam(value = "budgetMax") Integer budgetMax,
                                      @RequestParam(value = "weddate") String weddate) {
        List<PlannerQueryInfoVO> r = WeddingRecomPlanner.getSmallMaketWorker(hotel_id, section, weddate,
                null, 3, null, budgetMax);
        return null == r ? "婚礼信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/getAllWorkerMsg")
    public String getAllWorkerMsg() {
        List<WorkerQueryInfoVO> r = WeddingRecomPlanner.getWorkerMsg();
        return null == r ? "婚礼信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/queryWeddingUserTag")
    public String testqueryWeddingUserTag(@RequestParam(value = "weddingId") String weddingId) {
        WeddingUserTagVO r = RecommendWeddingPlanner.queryWeddingUserTag(weddingId);
        return null == r ? "婚礼信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/testQueryHotelRegion")
    public String testqueryHotelRegion(@RequestParam(value = "hotel_id") String hotel_id,
                                       @RequestParam(value = "region") String region,
                                       @RequestParam(value = "inArea") Integer inArea,
                                       @RequestParam(value = "weddate") String weddate) {
        List<HotelPlannerRecomRankVO> hotelPlannerList = WeddingRecomPlanner.getHotelSectionPlanner(inArea, Integer.valueOf(region), hotel_id, weddate);
//        if (inArea == 0) {
//            ResultScanner lowBudgetScanner = HBaseUtil.queryRowsWithKeys("rp_tb_low_budget_hotel", hotel_id + "=" + region, hotel_id + "=" + region + ">");
//            Iterator<Result> it = lowBudgetScanner.iterator();
//            while (it.hasNext()) {
//                HotelPlannerRecomRankVO vo = Result2Vo.getHotelPlannerRecomRankVO(it.next());
//                hotelPlannerList.add(vo);
//            }
//            if (hotelPlannerList.isEmpty()) {
//                lowBudgetScanner = HBaseUtil.queryRowsWithKeys("rp_tb_low_budget_hotel_stream", hotel_id + "=" + region, hotel_id + "=" + region + ">");
//                it = lowBudgetScanner.iterator();
//                while (it.hasNext()) {
//                    HotelPlannerRecomRankVO vo = Result2Vo.getHotelPlannerRecomRankVO(it.next());
//                    hotelPlannerList.add(vo);
//                }
//            }
//        } else {
//            ResultScanner lowBudgetScanner = HBaseUtil.queryRowsWithKeys("rp_tb_low_budget_hotel_area_score", hotel_id + "=" + region, hotel_id + "=" + region + ">");
//            Iterator<Result> it = lowBudgetScanner.iterator();
//            while (it.hasNext()) {
//                HotelPlannerRecomRankVO vo = Result2Vo.getHotelPlannerAreaScoreVO(it.next());
//                hotelPlannerList.add(vo);
//            }
//            if (hotelPlannerList.isEmpty()) {
//                lowBudgetScanner = HBaseUtil.queryRowsWithKeys("tb_low_budget_hotel_area_score_stream", hotel_id + "=" + region, hotel_id + "=" + region + ">");
//                it = lowBudgetScanner.iterator();
//                while (it.hasNext()) {
//                    HotelPlannerRecomRankVO vo = Result2Vo.getHotelPlannerRecomRankVO(it.next());
//                    hotelPlannerList.add(vo);
//                }
//            }
//        }
//            if (vo.getZone().equals("锦江区") ||
//                    vo.getZone().equals("武侯区") ||
//                    vo.getZone().equals("成华区") ||
//                    vo.getZone().equals("青羊区") ||
//                    vo.getZone().equals("金牛区")) {
//                if (vo.getDistance() <= 40000) {
//                    hotelPlannerList.add(vo);
//                }
//            } else {
//                hotelPlannerList.add(vo);
//            }
        return gson.toJson(hotelPlannerList);
    }

    @ResponseBody
    @RequestMapping("/queryHotelRegion")
    public String queryHotelRegion(@RequestParam(value = "hotel_id") String hotel_id,
                                   @RequestParam(value = "region") String region) {
        List<HotelPlannerRecomRankVO> hotelPlannerList = new ArrayList<>();
        ResultScanner lowBudgetScanner = HBaseUtil.queryRowsWithKeys("rp_tb_low_budget_hotel", hotel_id + "=" + region, hotel_id + "=" + region + ">");
        Iterator<Result> it = lowBudgetScanner.iterator();
        List<Integer> sectionList = new ArrayList<>();
        while (it.hasNext()) {
            HotelPlannerRecomRankVO vo = Result2Vo.getHotelPlannerRecomRankVO(it.next());
            sectionList.add(vo.getSection());
            if (vo.getDistance() <= 40000) {
                hotelPlannerList.add(vo);
            }
        }
        return gson.toJson(hotelPlannerList);
    }

    @ResponseBody
    @RequestMapping("/plannerRecomRank")
    public String testWeddingUserTagVO(@RequestParam(value = "budget") Integer budget,
                                       @RequestParam(value = "inArea") Integer inArea) {
        List<PlannerRecomRankVO> r = WeddingRecomPlanner.getAllWorkerRank(budget, inArea);
        return null == r ? "婚礼标签信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/JJPlanner")
    public String getJJPlanner() {
        List<JJPlannerVO> r = RecommendWeddingPlanner.querJJPlanner();
        return null == r ? "婚礼标签信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/userByMsisdn")
    public String testUserByMsisdn(@RequestParam(value = "msisdn") String msisdn) {
        UserByCrmVO r = RecommendWeddingPlanner.getUserByMsisdnV2(msisdn);
        return null == r ? "婚礼标签信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/WorkerIdByUserId")
    public String testWorkerIdByUserId(@RequestParam(value = "crmUserID") String crmUserID) {
        String r = RecommendWeddingPlanner.getWorkerIdByUserIdV3(crmUserID);
        return null == r ? "婚礼标签信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/WorkerIdGetService")
    public String testWorkerIdGetService(@RequestParam(value = "worker_id") String worker_id) {
        List list = new ArrayList<String>();
        list.add(worker_id);
        Map<String, List<WorkerServiceVO>> r = RecommendWeddingPlanner.getWorkerServicesList(list);
        return null == r ? "婚礼标签信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/WorkerVOById")
    public String testWorkerVOById(@RequestParam(value = "workerId") String workerId) {
        WorkerVO r = RecommendWeddingPlanner.getWorkerVOById(workerId);
        return null == r ? "婚礼标签信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/FuzzyWorkers")
    public String testFuzzyWorkers(@RequestParam(value = "workerName") String workerName,
                                   @RequestParam(value = "weddate") String weddate) {
        List<WorkerQueryInfoVO> r = CombineAction.
                getFuzzyWorkers(workerName, weddate, "all");
        return null == r ? "婚礼标签信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/AllWorkers")
    public String testAllWorkers(@RequestParam(value = "status") String status,
                                 @RequestParam(value = "vocation_id") String vocation_id) {
        List<WorkerVO> r = RecommendWeddingPlanner.getAllWorkers(HBaseUtil.getFilterList(status, null, vocation_id));
        return null == r ? "婚礼标签信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/UserVO")
    public String testUserVO(@RequestParam(value = "ids") String ids) {
        List<String> idlist = new ArrayList<>();
        String[] t = ids.split(",");
        for (String id : t) {
            idlist.add(id);
        }
        Map<String, UserVO> r = RecommendWeddingPlanner.getUserVOList2Map(idlist);
        return null == r ? "婚礼标签信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/ServiceWorker")
    public String testServiceWorker(@RequestParam(value = "weddate") String weddate,
                                    @RequestParam(value = "vocationId") String vocationId
    ) {
//        List<WorkerQueryInfoVO> r = WeddingRecomPlanner.getServiceWorker(weddate, null,
//                null, vocationId, -1, -1);
        String newDateStr = weddate.substring(0, 4) + "-" + weddate.substring(4, 6) + "-" + weddate.substring(6);
        logger.info("_______  ServiceWorker  newDateStr " + newDateStr);
        List<WorkerQueryInfoVO> r = PlannerMsg.queryCanOrderPlanner(newDateStr, 1);
        return null == r ? "婚礼标签信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/oneWorkerService")
    public String getOneWorkerService(@RequestParam(value = "weddate") String weddate,
                                      @RequestParam(value = "worker_id") String worker_id
    ) {
        String r = WeddingRecomPlanner.getOneWorkerService(weddate, worker_id);
        return r;
    }

    // 尝试写的新测试接口内容。

    /**
     * 多个resultList互相addAll。有点难搞
     */
    @ResponseBody
    @RequestMapping("/GetNormePlanner")
    public String testGetNormePlanner(@RequestParam(value = "resultList") List<PlannerQueryInfoVO> resultList,
                                      @RequestParam(value = "workersList") List<WorkerQueryInfoVO> workersList,
                                      @RequestParam(value = "recomRankMap") Map<String, List<PlannerRecomRankVO>> recomRankMap,
                                      @RequestParam(value = "weddingId") String weddingId,
                                      @RequestParam(value = "inArea") int inArea
    ) {
        WeddingUserTagVO tag = RecommendWeddingPlanner.queryWeddingUserTag(weddingId);
        String[] tagList = WeddingRecomPlanner.getTagList(tag);// 这两个红线方法是private的，调用不到
        UserWeddingVO wedding = RecommendWeddingPlanner.getUserWeddingById(weddingId);
        List<PlannerQueryInfoVO> r = WeddingRecomPlanner.getNormePlanner(resultList, workersList, recomRankMap, tagList, wedding.getBudgetMin(), wedding.getBudgetMax(), inArea);
        return null == r ? "符合条件的策划师信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/GetRecomPlanner")
    public String testGetRecomPlanner(@RequestParam(value = "workerId") String workerId,
                                      @RequestParam(value = "weddingId") String weddingId
    ) {
        UserWeddingVO wedding = RecommendWeddingPlanner.getUserWeddingById(weddingId);
        List<PlannerRecomRecordVO> r = WeddingRecomPlanner.getRecomPlanner(wedding, workerId);// 这个红线方法是private的，调用不到
        return null == r ? "预约时推荐的策划师信息不存" : gson.toJson(r);
    }

    /**
     * 多个resultList互相addAll。有点难搞
     */
//    @ResponseBody
//    @RequestMapping("/ProcessHotelRecomWorker")
//    public String testProcessHotelRecomWorker(@RequestParam(value = "workersList") List<WorkerQueryInfoVO> workersList,
//                                              @RequestParam(value = "recomRankMap") Map<String, List<PlannerRecomRankVO>> recomRankMap,
//                                              @RequestParam(value = "weddingId") String weddingId,
//                                              @RequestParam(value = "responsize") int responsize,
//                                              @RequestParam(value = "resultList4") List<PlannerQueryInfoVO> resultList4
//    ) {
//        List<PlannerRecomRankVO> plannerList = RecommendWeddingPlanner.queryPlannerRecomRank();
//        WeddingUserTagVO tag = RecommendWeddingPlanner.queryWeddingUserTag(weddingId);
//        String[] tagList = WeddingRecomPlanner.getTagList(tag); // 这两个红线方法是private的，调用不到
//        UserWeddingVO wedding = RecommendWeddingPlanner.getUserWeddingById(weddingId);
//        List<PlannerRecomRecordVO> r = WeddingRecomPlanner.processHotelRecomWorker(wedding.getBudgetMax(), wedding.getHotel(), wedding.getProvinceName(), wedding.getCityName(),
//                wedding.getHotelId(), workersList, resultList4, plannerList, recomRankMap, tagList, (responsize - resultList4.size()),
//                wedding.getWeddingDate(), wedding.getHotelId());
//
//        WeddingRecomPlanner.processHotelRecomWorker(wedding.getBudgetMax(),wedding.getHotel(),wedding.getProvinceName(),
//                wedding.getCityName(),wedding.getHotelId(),workersList,)
//        return null == r ? "酒店推荐的策划师信息不存" : gson.toJson(r);
//    }
    @ResponseBody
    @RequestMapping("/GetDistance")
    public String testGetDistance(@RequestParam(value = "workerId") String workerId,
                                  @RequestParam(value = "weddingId") String weddingId
    ) {
        String r = WeddingRecomPlanner.getDistance(workerId, weddingId);
        return null == r ? "预约时推荐的策划师信息不存" : gson.toJson(r);
    }


    @ResponseBody
    @RequestMapping("/getAllWorkersV3")
    public String getAllWorkersV2(@RequestParam(value = "status") String status,
                                  @RequestParam(value = "vocationId") String vocationId
    ) {
        Object r = PlannerMsg.queryAllWorkers();
        return null == r ? "预约时推荐的策划师信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/queryWorkerServiceV3")
    public String queryWorkerServiceV3(
    ) {
        Object r = PlannerMsg.queryWorkerService();
        return null == r ? "预约时推荐的策划师信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/getPlannerV3")
    public String getHasSchedulePlannerV3(@RequestParam(value = "weddate") String weddate
    ) {
        Object r = PlannerMsg.queryHasSchedulePlaner(weddate);
        return null == r ? "预约时推荐的策划师信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/getAllUsersV3")
    public String getAllUsersV3(
            @RequestParam(value = "weddate") String weddate) {
        Object r = PlannerMsg.queryWorkerWeddingOrders(weddate);
        return null == r ? "预约时推荐的策划师信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/queryWorkerScheduleV3")
    public String queryWorkerScheduleV3(
            @RequestParam(value = "weddate") String weddate) {
        Object r = PlannerMsg.queryWorkerSchedule(weddate);
        return null == r ? "预约时推荐的策划师信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/queryWorkerDayLimitV3")
    public String queryWorkerDayLimitV3(
            @RequestParam(value = "weddate") String weddate) {
        Object r = PlannerMsg.queryWorkerDayLimit(weddate);
        return null == r ? "预约时推荐的策划师信息不存" : gson.toJson(r);
    }

    @ResponseBody
    @RequestMapping("/queryCanOrderPlannerV3")
    public String queryCanOrderPlannerV3(
            @RequestParam(value = "weddate") String weddate,
            @RequestParam(value = "flag") Integer flag) {
        Object r = PlannerMsg.queryCanOrderPlanner(weddate, flag);
        return null == r ? "预约时推荐的策划师信息不存" : gson.toJson(r);
    }


//    @ResponseBody
//    @RequestMapping("/getAllWorkersV2")
//    public String getAllWorkersV2(@RequestParam(value = "status") String status,
//                                  @RequestParam(value = "vocationId") String vocationId,
//                                  @RequestParam(value = "isDebug") Integer isDebug
//    ) {
//        Object r = new PlannerService().getAllWorkers(isDebug, status, vocationId);
//        return null == r ? "预约时推荐的策划师信息不存" : gson.toJson(r);
//    }
//
//
//    @ResponseBody
//    @RequestMapping("/getAllUsersV2")
//    public String getAllUsersV2(
//            @RequestParam(value = "isDebug") Integer isDebug) {
//        Object r = new PlannerService().getAllUsers(isDebug);
//        return null == r ? "预约时推荐的策划师信息不存" : gson.toJson(r);
//    }
//
//
//    @ResponseBody
//    @RequestMapping("/getAllWorkerServiceListV2")
//    public String getAllWorkerServiceListV2(
//            @RequestParam(value = "isDebug") Integer isDebug) {
//        Object r = new PlannerService().getAllWorkerServiceList(isDebug);
//        return null == r ? "预约时推荐的策划师信息不存" : gson.toJson(r);
//    }
//
//    @ResponseBody
//    @RequestMapping("/getAllWorkerServicesV2")
//    public String getAllWorkerServicesV2(@RequestParam(value = "status") Integer status,
//                                         @RequestParam(value = "isDebug") Integer isDebug) {
//        Object r = new PlannerService().getAllWorkerServices(status, isDebug);
//        return null == r ? "预约时推荐的策划师信息不存" : gson.toJson(r);
//    }
//
//    @ResponseBody
//    @RequestMapping("/getAllWorkerActivityV2")
//    public String getAllWorkerActivityV2(@RequestParam(value = "status") String status, @RequestParam(value = "isDebug") Integer isDebug
//    ) {
//        Object r = new PlannerService().getAllWorkerActivity(status, isDebug);
//        return null == r ? "预约时推荐的策划师信息不存" : gson.toJson(r);
//    }
//
//    @ResponseBody
//    @RequestMapping("/getWorkerWeddingOrdersV2")
//    public String getWorkerWeddingOrders(@RequestParam(value = "weddingMonth") String weddingMonth,
//                                         @RequestParam(value = "thisMonth") String thisMonth,
//                                         @RequestParam(value = "isDebug") Integer isDebug
//    ) {
//        Dataset r = new PlannerService().getWorkerWeddingOrders(weddingMonth, isDebug, thisMonth);
//        return null == r ? "预约时推荐的策划师信息不存" : gson.toJson(r);
//    }
//
//    @ResponseBody
//    @RequestMapping("/getWorkerSchedulesV2")
//    public String getWorkerSchedulesV2(@RequestParam(value = "weddingDay") String weddingDay,
//                                       @RequestParam(value = "isDebug") Integer isDebug
//    ) {
//        Object r = new PlannerService().getWorkerSchedules(weddingDay, isDebug);
//        return null == r ? "预约时推荐的策划师信息不存" : gson.toJson(r);
//    }
//
//    @ResponseBody
//    @RequestMapping("/getWorkerMonthOrderLimitV2")
//    public String getWorkerMonthOrderLimitV2(@RequestParam(value = "weddingMonth") String weddingMonth,
//                                             @RequestParam(value = "thisMonth") String thisMonth,
//                                             @RequestParam(value = "isDebug") Integer isDebug
//    ) {
//        Object r = new PlannerService().getWorkerMonthOrderLimit(weddingMonth, isDebug, thisMonth);
//        return null == r ? "预约时推荐的策划师信息不存" : r.toString();
//    }
//
//    @ResponseBody
//    @RequestMapping("/getWorkerLocationV2")
//    public String getWorkerLocationV2(@RequestParam(value = "isDebug") Integer isDebug
//    ) {
//        Object r = new PlannerService().getWorkerLocation(isDebug);
//        return null == r ? "预约时推荐的策划师信息不存" : gson.toJson(r);
//    }
//
//    @ResponseBody
//    @RequestMapping("/getOneDayServicePlannerV2")
//    public String getAllUsersV2(@RequestParam(value = "day") String day,
//                                @RequestParam(value = "num") Integer num,
//                                @RequestParam(value = "isDebug") Integer isDebug
//    ) {
//        Object r = new PlannerService().getOneDayServicePlanner(day, num, isDebug);
//        return null == r ? "预约时推荐的策划师信息不存" : gson.toJson(r);
//    }

//    @ResponseBody
//    @RequestMapping("/getAllUsersV2")
//    public String getAllUsersV2(@RequestParam(value = "workerId") String workerId,
//                                @RequestParam(value = "weddingId") String weddingId
//    ) {
//        String r = new PlannerService().getAllUsers();
//        return null == r ? "预约时推荐的策划师信息不存" : gson.toJson(r);
//    }

}


